<template>
<div class="recent_event">
	<el-table
		    :data="informationData.data"
		    style="width: 100%;border:10px;background-color: #212C4F;"
            :empty-text="$lang('NODATA')"
            border
            :show-header = false
		  	:row-style="{
		  		'border':'none',
		  		'background-color':'#1D2748',
		  		'border-bottom':'none',
		  		'text-align':'center',
		  	}"	
		  	>
		    <el-table-column
		      prop="createDate"
		      width="120">
		    </el-table-column>

		    <el-table-column
		      prop="zhTitle">
		      <template scope='scope' >
                    <router-link :to="{ path: '/News/',query: {id: scope.row.id}}" style="width:100%;color:#fff;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">
                        <div class="newT">
                            <div v-if="scope.row.sort" class="zhiding">{{ $lang('Top') }}</div>
                            <div class="newTT">{{ $i18n.locale == 'zh'?scope.row.zhTitle || $lang('No_data'):scope.row.enTitle || $lang('No_data')}}</div>
                            <div>>></div>
                        </div>
                    </router-link>
                </template>
		    </el-table-column>
		  </el-table>
		  <el-pagination v-if="informationData.totalCount !== 0"
		    layout="prev, pager, next"
            @current-change="getInformation"
		    :total="informationData.totalPage*10">
		  </el-pagination>
</div>
</template>

<script>
import { gets } from "@/api/api.js";
export default {
	data(){
		return {
			overflow:false,	 // 控制文章高度
			showload:false, // 控制加载更多按钮
            controlDir:0,
            informationData: []
		}
    },
    created() {
    },
	methods:{
		loading(){
			this.overflow = !this.overflow;
			this.controlDir ++ ;
			this.$refs.load.style.transform = 'rotate('+ 180 * this.controlDir +'deg)' ;
        },
        async getInformation(type) {
            let that = this
            try {
                let res = await gets.searchCompanyList("/information/find-page.json", {
                    companyId : that.$store.state.common.companyId,
                    pageNo: type,
                    pageSize: 5
                });
                // console.log(res)
                that.informationData = res.data
            } catch (e) {
                console.log(e)
                throw e;
            }
        },
		// getHeightStatus(){ // 获取高度的状态
		// 	let h = this.$refs.article.clientHeight;
		// 	if(h <= 360){ // 当新闻数字大于360高就隐藏 并且加载更多文章出现
		// 		this.overflow = false; 
		// 		this.showload = false;
		// 	}else {
		// 		this.overflow = true;
		// 		this.showload = true;
		// 	}
		// }
	},
	mounted(){
		this.getInformation(1)
	},
	updated(){
		
	}
}
</script>

<style>
.zhiding{
    width: 40px;
    text-align: center;
    background: #344E8F;
    border-radius: 3px;
    margin-right: 10px;
}
.newT{
    display: flex;
    width: 100%;
}
.newT .newTT{
    flex: 1;
    color: rgb(255, 255, 255);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}
</style>